import 'package:flutter/material.dart';
import 'package:get/get.dart';

class Dialog extends StatelessWidget {
  const Dialog({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        ElevatedButton(
          child: Text('弹窗'),
          onPressed: () {
            // 普通弹窗
            Get.defaultDialog(
              title: '标题',
              middleText: '内容',
            );
          },
        ),
        ElevatedButton(
            onPressed: () {
              // 信息弹窗
              Get.snackbar('标题', '内容');
            },
            child: Text('snackbar')),
        ElevatedButton(
            onPressed: () {
              // 底部弹窗
              Get.bottomSheet(
                  Column(
                    children: [
                      ListTile(
                        title: Text('白天模式'),
                        onTap: () {
                          Get.changeTheme(ThemeData.light());
                        },
                      ),
                      ListTile(
                        title: Text('夜晚模式'),
                        onTap: () {
                          Get.changeTheme(ThemeData.dark());
                        },
                      ),
                    ],
                  ),
                  backgroundColor: Colors.white);
            },
            child: Text('Sheet')),
      ],
    );
  }
}
